<?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'category-form',
        'enableAjaxValidation' => false,
        'enableClientValidation' => true,
        'htmlOptions' => array(
            'class' => 'form-horizontal',
             'enctype' => 'multipart/form-data'
        ),
    ));
?>
<div class="row-fluid">
    <div class="span12">
        <!--PAGE CONTENT BEGINS-->
                <div class="control-group">
                    <h4>Main Content</h4>
                </div>
                
                <div class="control-group">
                    <?php echo $form->labelEx($model, 'event_code', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->textField($model, 'event_code', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Event code')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'event_code'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelex($model, 'video_link', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->textField($model, 'video_link', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Video link')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'video_link'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelex($model, 'contact', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->textField($model, 'contact', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Contact')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'contact'); ?></span>
                    </div>
                </div>
        
                <div class="control-group">
                   <?php echo $form->labelex($model, 'start_date', array('class' => 'control-label')); ?>
                   <div class="controls">
                               <div class="row-fluid input-append">
                                        <?php echo $form->textField($model, 'start_date',array('data-date-format'=>'dd-mm-yyyy','class'=>'date-picker')); ?>
                                       <span class="add-on">
                                               <i class="icon-calendar"></i>
                                       </span>
                                   <span class="help-inline"><?php echo $form->error($model, 'expired_date'); ?></span>
                               </div>
                   </div>
                </div>       
        
                <div class="control-group">
                    <?php echo $form->labelex($model, 'start_time', array('class' => 'control-label')); ?>
                    <div class="controls">
                                    <div class="input-append bootstrap-timepicker">
                                            <?php echo $form->textField($model, 'start_time',array('class'=>'input-small timepicker1')); ?>
                                            <span class="add-on">
                                                    <i class="icon-time"></i>
                                            </span>
                                    </div>
                        <span class="help-inline"><?php echo $form->error($model, 'start_time'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelEx($model, 'active_status', array('class' => 'control-label')); ?>
                    <div class="controls">
                         <?php echo $form->dropDownlist($model, 'active_status', array(0 => 'Inactive',1=> 'Active')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'active_status'); ?></span>
                    </div>
                </div>
        

                <div class="control-group" style="display:none;">
                    <?php echo $form->labelex($model, 'fileImage', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->fileField($model, 'fileImage', array('class' => 'id-input-file-1 span5')); ?>
                        <span class="help-inline" style="float:left;margin-left:390px;"><?php echo $form->error($model, 'fileImage'); ?></span>
                    </div>
                </div>

                <div class="control-group">
                    <?php echo $form->labelex($model, 'priority', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->textField($model, 'priority', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Priority')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'priority'); ?></span>
                    </div>
                </div>
                
<!--                <div class="control-group">
                    <?php echo $form->labelex($model, 'tag', array('class' => 'control-label')); ?>
                    <div class="controls">
                         <?php echo $form->textField($model, 'tag', array('data-role' => 'tagsinput', 'class' => 'span5','placeholder'=>'Add tag')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'tag'); ?></span>
                    </div>
                </div>-->
                <div class="control-group">
                    <?php echo $form->labelEx($model, 'category_id', array('class' => 'control-label')); ?>
                    <div class="controls">
                         <?php echo $form->dropDownlist($model, 'category_id', MyFunctionCustom::getDropdownlistCategoryEvent(),array('class' => 'span5', 'placeholder' => 'Language')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'category_id'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelex($model, 'gallery_id', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <div  id="gallary-tmp" style="margin-bottom:10px;">
                            <?php if($model->gallery_id !=''): 
                                 $gallery = Item::model()->with('gallery')->findByAttributes(array('gallery_id'=>$model->gallery_id));
                                 if($gallery):
                            ?>
                            <img src="<?php echo Yii::app()->baseUrl; ?>/timthumb.php?src=<?php echo Yii::app()->baseUrl; ?>/data/image/event/<?php echo $gallery->name; ?>&h=150&w=150" />
                            <?php endif;endif; ?>
                        </div>
                         <?php echo $form->hiddenField($model,'gallery_id');?>
                         <?php echo $form->hiddenField($model,'tmpGallery');?>
                        <a href="#modal-form" role="button" class="blue" data-toggle="modal">
                           <button class="btn btn-small btn-primary">Choose Gallery</button>
                        </a>
                        <span class="help-inline"><?php echo $form->error($model, 'gallery_id'); ?></span>
                    </div>
                </div>
                <div class="span11">
                    <h4>Language Translate. ( Please fill all field after that you should select the second language)</h4>
                    <div class="control-group">
                        <?php echo $form->labelEx($translate, 'language_id', array('class' => 'control-label')); ?>
                        <div class="controls">

                            <?php echo $form->dropDownlist($translate, 'language_id', MyFunctionCustom::getDropdownlistLanguage(),array('class' => 'span5', 'placeholder' => 'Language')); ?>
                            <span class="help-inline"><?php echo $form->error($model, 'language_id'); ?></span>
                        </div>
                    </div>
                    <div class="vi-span span8">
                        
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'main_title', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="Main title" name="Translate[vi][main_title]" id="Translate_main_title" type="text" />
                            
                                <span class="help-inline"><?php echo $form->error($translate, 'main_title'); ?></span>
                            </div>
                        </div>
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'sub_title', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="Sub title" name="Translate[vi][sub_title]" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'sub_title'); ?></span>
                            </div>
                        </div>
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'sub_title1', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="Sub title 1" name="Translate[vi][sub_title1]" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'sub_title1'); ?></span>
                            </div>
                        </div>
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'sub_title2', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="Sub title 2" name="Translate[vi][sub_title2]" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'sub_title2'); ?></span>
                            </div>
                        </div>
                        
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'location', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="Ex: SVĐ Phú thọ,Sân Khấu Lan Anh" name="Translate[vi][location]" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'location'); ?></span>
                            </div>
                        </div>
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'address', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="219 Lý thường kiệt, Q. 10" name="Translate[vi][address]" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'address'); ?></span>
                            </div>
                        </div>
                        
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'text_contact', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="Hết vé, Bị Hoãn...." name="Translate[vi][text_contact]" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'text_contact'); ?></span>
                            </div>
                        </div>

                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'text_ticket', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="Hết vé loại ABC...." name="Translate[vi][text_ticket]" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'text_ticket'); ?></span>
                            </div>
                        </div>
                        
        
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'description', array('class' => 'control-label')); ?>
                            <div class="controls">

                                <span class="help-inline"><?php echo $form->error($translate, 'description'); ?></span>
                            </div>
                        </div>

                        <?php
                        $this->widget('ext.editMe.ExtEditMe', array(
                            'name' => 'Translate[vi][description]',
                            'height' => '250px',
                            'width' => '100%',
                            'attribute' => 'description',
                            'toolbar' => Yii::app()->params['ckeditor'],
                            'filebrowserBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html',
                            'filebrowserImageBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html?type=Images',
                            'filebrowserFlashBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html?type=Flash',
                            'filebrowserUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
                            'filebrowserImageUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
                            'filebrowserFlashUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash',
                        ));
                        ?>
                        
                </div>
                <div class="en-span span8">
                    <div class="control-group">
                            <?php echo $form->labelex($translate, 'main_title', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="Main title" name="Translate[en][main_title]" id="Translate_main_title" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'main_title'); ?></span>
                            </div>
                        </div>
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'sub_title', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="Sub title" name="Translate[en][sub_title]" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'sub_title'); ?></span>
                            </div>
                        </div>
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'sub_title1', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="Sub title 1" name="Translate[en][sub_title1]" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'sub_title1'); ?></span>
                            </div>
                        </div>
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'sub_title2', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="Sub title 2" name="Translate[en][sub_title2]" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'sub_title2'); ?></span>
                            </div>
                        </div>
                        
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'location', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="Phu Tho Stadium, Hoa Binh Theatre..." name="Translate[en][location]" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'location'); ?></span>
                            </div>
                        </div>
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'address', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="249 Ly Thuong Kiet, Q 10..." name="Translate[en][address]" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'address'); ?></span>
                            </div>
                        </div>
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'text_contact', array('class' => 'control-label span3')); ?>
                            <div class="controls">
                                <input size="60" maxlength="255" class="span10" placeholder="No Ticket, Expired" name="Translate[en][text_contact]" type="text" />
                                <span class="help-inline"><?php echo $form->error($translate, 'text_contact'); ?></span>
                            </div>
                        </div>

                    <div class="control-group">
                        <?php echo $form->labelex($translate, 'text_ticket', array('class' => 'control-label span3')); ?>
                        <div class="controls">
                            <input size="60" maxlength="255" class="span10" placeholder="Ticket ABC has been solved...." name="Translate[en][text_ticket]" type="text" />
                            <span class="help-inline"><?php echo $form->error($translate, 'text_ticket'); ?></span>
                        </div>
                    </div>
        
                        <div class="control-group">
                            <?php echo $form->labelex($translate, 'description', array('class' => 'control-label')); ?>
                            <div class="controls">

                                <span class="help-inline"><?php echo $form->error($translate, 'description'); ?></span>
                            </div>
                        </div>

                        <?php
                        $this->widget('ext.editMe.ExtEditMe', array(
                            'name' => 'Translate[en][description]',
                            'height' => '250px',
                            'width' => '100%',
                            'attribute' => 'description',
                            'toolbar' => Yii::app()->params['ckeditor'],
                            'filebrowserBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html',
                            'filebrowserImageBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html?type=Images',
                            'filebrowserFlashBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html?type=Flash',
                            'filebrowserUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
                            'filebrowserImageUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
                            'filebrowserFlashUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash',
                        ));
                        ?>
                </div>
            </div>
            <div class="span8">
            <div class="form-actions">
                <button class="btn btn-info" type="submit">
                    <i class="icon-ok bigger-110"></i>
                    Submit
                </button>
                &nbsp; &nbsp; &nbsp;
                <button class="btn" type="reset">
                    <i class="icon-undo bigger-110"></i>
                    Reset
                </button>
            </div>
            </div>

    </div>
</div>

 <?php $this->endWidget(); ?>
<script src="<?php echo Yii::app()->theme->baseUrl; ?>/backend/tag/bootstrap-tagsinput.js"></script>
<script type="text/javascript">
    
    $(document).ready(function(){
        $('.en-span').hide();
        $('#Translate_language_id').change(function(){
            if ($('.vi-span').is(':visible')) {
                $('.vi-span').hide();
                $('.en-span').show();
            }else{
                $('.en-span').hide();
                $('.vi-span').show();
            }        
        });
    });
    

    
</script>
<link rel="stylesheet" href="<?php echo Yii::app()->theme->baseUrl; ?>/backend/tag/bootstrap-tagsinput.css">
<style>
    .control-group span.required,.errorMessage {color:red;}
    .bootstrap-tagsinput {width:365px;margin-top:5px;}
    .ace-file-input {width: 380px;height: auto;}

    .div1, .div2, .div3{
        float: left;
    }
    .div1 select, .div2 select{
    margin-left: 20px;
    width: 50px;
    }
    
    .div2 label{
        width: 100px !important;
    }
    
    .div3 input{
        width: 200px !important;
    }
    
    .jason{
        display: none;
    }
    
    .add{
        clear: both;
        padding-top: 10px;
    }
    
    .div4 .controls a{
        height: 18px;
        vertical-align: middle;        
    }
    
    .div4 .btn{
        line-height: 0px;
    }
</style>

<?php echo $this->renderPartial('_popup', array('model'=>$model,'data' =>$data)); ?>

